{template header}
<link href="{GODHOUSE_DOMAIN_WWW}css/calendar.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="{GODHOUSE_DOMAIN_WWW}js/calendar.js"></script>
<script language="javascript" type="text/javascript" src="{GODHOUSE_DOMAIN_WWW}js/calendar-zh.js"></script>

<script language="javascript">
jQuery(function(){

	jQuery('#ispromotions').click(
		function(){
			if(jQuery(this).attr('checked') == true) {
				jQuery('#promotionsDisplay').show();
			} else {
				jQuery('#promotionsDisplay').hide();
			}
		}
	);
	
	var ispromotions = '{$gifts[ispromotions]}';
	if(ispromotions==1)
	{
		jQuery('#ispromotions').attr('checked', true);
		jQuery('#promotionsDisplay').show();
	}
			  
	jQuery('#startDate').click(function(){showCalendar('startDate');});
	jQuery('#endDate').click(function(){showCalendar('endDate');});

	jQuery('form[name=create]').submit(function(){
		
		if(jQuery('#categoryId').val()==0) {
			alert('请选择礼品类型');
			jQuery('#categoryId').focus();
			return false;
		}
		
		if(jQuery('#title').val()=='')
		{
			alert('请输入礼品标题');
			jQuery('#title').focus();
			return false;
		}
			
		if(jQuery('#startDate').val()=='')
		{
			alert('请选择开始日期');
			jQuery('#startDate').focus();
			return false;
		}
		
		if(jQuery('#endDate').val()=='')
		{
			alert('请选择结束日期');
			jQuery('#endDate').focus();
			return false;
		}
		
		if(jQuery('#inventory').val()=='')
		{
			alert('请输入库存数量');
			jQuery('#inventory').focus();
			return false;
		}
	});
});
</script>
<div class="path">
	<span><a href="gifts-admin.htm">礼品管理</a></span>
	<span>添加礼品</span>
</div>
<div class="content">
	<div class="c1">
	<form name="create" action="gifts-$action-$giftsId.htm" method="post" enctype="multipart/form-data">
	      <table width="100%" border="0" cellspacing="2" cellpadding="2" style="text-align:center">
	        <tr>
	          <td width="10%" height="30" align="right">礼品类型：</td>
	          <td width="90%" align="left">
	          <select id="categoryId" name="gifts[categoryId]">
	          	<option value="0" {if $gifts[categoryId]==0}selected="selected"{/if}>请选择分类</option>
	          	<!--{loop $categorys $v}-->
	          	<option value="$v[categoryId]" {if $gifts[categoryId]==$v[categoryId]}selected="selected"{/if}>$v[cateName]</option>
	          	<!--{/loop}-->
	          </select>	          </td>
	        </tr>
	        <tr>
	          <td height="30" align="right">礼品名称：</td>
	          <td align="left"><input type="text" name="gifts[title]" id="title" value="$gifts[title]" style="width:300px;" /></td>
	        </tr> 
	        <tr>
	          <td height="30" align="right">开始日期：</td>
	          <td align="left">
			  <table width="100%" border="0" cellpadding="0" cellspacing="0">
			  <td align="left"><div id="promotionsDisplay""><input name="gifts[startDate]" id="startDate" value="$gifts[startDate]" type="text" style="width:60px;" />&nbsp;&nbsp;结束日期：<input name="gifts[endDate]" id="endDate" value="$gifts[endDate]" type="text" style="width:60px;" /></div></td>
			  </table>			  </td>
            </tr>
	        <tr>
	          <td height="30" align="right">兑换积分：</td>
	          <td align="left"><input type="text" name="gifts[credit]" value="$gifts[credit]" style="width:300px;" /></td>
            </tr>
	        <tr>
	          <td height="30" align="right">库存数量：</td>
	          <td align="left"><input type="text" name="gifts[inventory]" value="$gifts[inventory]" style="width:300px;" /></td>
            </tr>
	        <tr>
	        	<td height="30" align="right">礼品图片：</td>
	          	<td align="left"><input type="file" name="picture" />{if $gifts[picture]}<a href="$gifts[picture]" target="_blank">查看原图</a>{/if}</td>
	        </tr>
	        <tr>
	        	<td height="30" align="right">内容描述：</td>
	          	<td align="left">
	          	<!--{eval include(GODHOUSE_ROOT."extend/fckeditor/fckeditor.php");
		$sBasePath = GODHOUSE_DOMAIN_WWW."extend/fckeditor/";
		$oCKeditor = new FCKeditor("gifts[content]") ;
		$oCKeditor->BasePath = $sBasePath ;
		$oCKeditor->Height='300px';
		//$oCKeditor->Width='400px';
		$oCKeditor->Value = $gifts[content];
		$oCKeditor->Create();
	          	}-->	          	</td>
	        </tr>
	        <tr>
	          <td height="30" align="right">&nbsp;</td>
	          <td align="left">
			<input type="submit" class="bigButton" name="submitTo" value="  提 交  " />	          </td>
	        </tr>
	      </table>
      </form>
	</div>
</div>
{template footer}